#pragma once
#include <iostream>
#include <stack>
using namespace std;
class binTreeNode
{
public:
	binTreeNode(int val = 0);
	~binTreeNode(void);

	binTreeNode* left();
	binTreeNode* right();
	int val(){return _val;}
	void setVal(int val){_val = val;}
	void setLeft(binTreeNode* left);
	bool is_leaf(){return !(_pleft||_pright);}

	void setRight(binTreeNode* right);
	
private:
	binTreeNode*  _pleft;
	binTreeNode*  _pright;
	int			  _val;
};

void prePrint( binTreeNode* node );
void prePrint_iter( binTreeNode* node );
void postPrint( binTreeNode* node );
void inPrint( binTreeNode* node );
void inPrint_iter( binTreeNode* node );
int printAtLevel( binTreeNode* node, int level); 
void rebuild( int* preArr, int* inArr, int len, binTreeNode* root);

//bool is_leaf( binTreeNode* node)
//{
//	return node->left() == 0 && node->right() == 0;
//}
void num_node_leave( binTreeNode* root, int& num_node, int& num_leaf);

